package net.wanho.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.wanho.entity.Store;
import net.wanho.mapper.StoreMapper;
import net.wanho.service.StoreService;
import net.wanho.vo.PageVo;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【store(仓库表)】的数据库操作Service实现
* @createDate 2025-05-05 02:08:26
*/
@Service
public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store>
    implements StoreService{

    @Override
    public PageVo<Store> pageList(Store store, Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<Store> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(Store::getStoreName, store.getStoreName())
                .like(Store::getStoreAddress, store.getStoreAddress())
                .like(Store::getConcat, store.getConcat())
                .like(Store::getPhone, store.getPhone());

        IPage<Store> page = new Page<>(pageNum, pageSize);
        page(page, queryWrapper);

        return new PageVo<>(
                page.getCurrent(),
                page.getSize(),
                page.getTotal(),
                page.getPages(),
                page.offset(),
                page.getRecords()
        );
    }
}




